/**
 * 
 */
package org.mips.Sirius.ui;

import android.graphics.Color;

/**
 * @author mips
 * 
 *         This class provides a fixed set of colours which can be used to
 *         colour a fixed set of items. These colours are as different as
 *         possible.
 */
public class Colouring {
	/*
	 * Retrieves the colour in hex-HTML notation (no #). Numbering starts from
	 * 0.
	 */
	public static int getColour(int number, int divisions) {

		// check for valid input
		if ((number + 1 > divisions) || (divisions < 1))
			return 0;

		// uses the HSV colour space to evenly distribute the colours
		float[] hsv = new float[3];
		hsv[0] = (360 / divisions) * number;
		hsv[1] = .7f;
		hsv[2] = 1;

		int colour = Color.HSVToColor(hsv);

		return colour;
	}

	public static String getHTMLColour(int colour) {
		return Integer.toHexString(colour).substring(2).toUpperCase();
	}
}
